package com.health.controller;

import com.health.annotation.AdminLog;
import com.health.common.Result;
import com.health.entity.PhysicalOrder;
import com.health.entity.pojo.dto.QueryPhysicalOrderDTO;
import com.health.entity.pojo.dto.QueryRegisterOrderDTO;
import com.health.entity.pojo.vo.RegisterOrderDownloadVO;
import com.health.service.IRegisterOrderService;
import com.health.util.EasyExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <p>
 * 挂号订单 前端控制器
 * </p>
 *
 * @author health
 * @since 2023-04-20
 */
@Api(tags = "挂号订单管理")
@RestController
@RequestMapping("/registerOrder")
public class RegisterOrderController extends BaseController{

    @Autowired
    IRegisterOrderService registerOrderService;

    @PostMapping("/listPageRegisterOrder")
    @ApiOperation("多条件查询挂号订单列表")
    @AdminLog("多条件查询挂号订单列表")
    public Result listPageRegisterOrder(@RequestBody QueryRegisterOrderDTO registerOrderDTO){
        System.out.println(registerOrderDTO);
        return dataResult(registerOrderService.listPageRegisterOrder(registerOrderDTO));
    }

    @PostMapping("/exportRegisterOrders")
    @ApiOperation("导出挂号订单列表")
    @AdminLog("导出挂号订单列表")
    public void exportRegisterOrderExcel(@RequestBody QueryRegisterOrderDTO registerOrderDTO, HttpServletResponse response) throws IOException {
        EasyExcelUtil.download(response,  RegisterOrderDownloadVO.class, registerOrderService.listPageDownloadRegisterOrder(registerOrderDTO));
    }

}
